/*
 * @Author: your name
 * @Date: 2021-10-21 20:59:04
 * @LastEditTime: 2021-10-22 21:12:36
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \luogu\动态规划\模板问题\P1020 导弹拦截\4test.cpp
 */
#include<iostream>
using namespace std;

int binarySearch(int a[],int len,int findnum)
{
    int l = 1,r = len;
    int m;
    while(l < r){
        m = (l+r)/2; //左开
        if(findnum > a[m]){
            l = m+1;
        }else{
            r = m;
        }
    }
    return l;
}
int binarySearch2(int a[],int len,int findnum)
{
    int l = 1,r = len;
    int m;
    while(l < r){
        m = (l+r)/2; //左开
        if(findnum < a[m]){
            l = m+1;
        }else{
            r = m;
        }
    }
    return l;
}

int main(){
    int a[6] = {0,1,3,5,7,9};
    int a1[10] = {0,9,7,5,5,3,1};
    while(1){
        int f;
        cin >> f;
        if(f == -1) break;
        // cout << binarySearch(a,5,f) << endl;
        cout << binarySearch2(a1,5,f) << endl;
    }
    return 0;
}